package Q3;

import java.awt.color.ICC_ColorSpace;
import java.util.Scanner;

public class Main {

    public static int ret;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        char[] ch = str.toCharArray();

        dfs(ch, 0, new StringBuilder());

        System.out.println(ret);
    }

    public static void dfs(char[] ch, int index, StringBuilder stringBuilder) {
        if (index == ch.length) {
            if (method(stringBuilder.toString())) {
                ret = Math.max(ret, stringBuilder.length());
            }

            return;
        }

        for (int i = index; i < ch.length; i++) {
            //选
            stringBuilder.append(ch[i]);
            dfs(ch, i + 1, stringBuilder);
            //回溯
            stringBuilder.deleteCharAt(stringBuilder.length() - 1);

            //不选
            dfs(ch, i + 1, stringBuilder);
        }
    }

    /**
     * 判断字符串是否为回文串
     * @param str
     * @return
     */
    public static boolean method(String str) {
        int len = str.length();
        int left = 0, right = len - 1;
        while (left < right) {
            if (str.charAt(left) != str.charAt(right)) {
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
